function factory(target) {
    let res = []
    function dfs(current, left, right) {
        if (res.length == target * 2) {
            res.push(current)
        }
        if (left < traget) {
            dfs(current + "(", left + 1, right)
        }
        if (right < left) {
            dfs(current + ")", left, right + 1)
        }
    }
    dfs("", 0, 0)
    return res
}